package day05;

import java.util.Arrays;
import java.util.Random;

public class MaxOfArray {
    public static void main(String[] args) {
        Random rand = new Random();
        int max=0;
        int[] arr = new int[10];
        for (int i = 0;i<arr.length;i++){
            arr[i]=rand.nextInt(100);
            System.out.println(arr[i]);
        }
        for (int i=0;i<arr.length;i++){
            max=max<arr[i]?arr[i]:max;
        }
        System.out.println("该数组的最大值为"+max);
        int[] b =Arrays.copyOf(arr,arr.length+1);
        b[b.length-1]=max;
        for (int i = 0;i<b.length;i++){
            System.out.println(b[i]);
        }
    }
}
